/*
 * ov10823.c - ov10823 sensor driver
 *
 * Copyright (c) 2016-2017, NVIDIA CORPORATION, All Rights Reserved.
 *
 * This program is free software; you can redistribute it and/or modify it
 * under the terms and conditions of the GNU General Public License,
 * version 2, as published by the Free Software Foundation.
 *
 * This program is distributed in the hope it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
 * more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

#include <media/camera_common.h>

#ifndef __OV10823_I2C_TABLES__
#define __OV10823_I2C_TABLES__

#define OV10823_TABLE_WAIT_MS	0
#define OV10823_TABLE_END	1
#define OV10823_MAX_RETRIES	3
#define OV10823_WAIT_MS	3
#define OV10823_ADJUST_HS_PREPARE 1

#define ov10823_reg struct reg_8

static ov10823_reg ov10823_start[] = {
	{0x0100, 0x01},
	{OV10823_TABLE_WAIT_MS, 66},
	{OV10823_TABLE_END, 0x00}
};

static ov10823_reg ov10823_stop[] = {
	{0x0100, 0x00},
	{OV10823_TABLE_END, 0x00}
};

static ov10823_reg fsync_master[] = {
	{0x3002, 0x88},
	{0x3009, 0x06},
	{0x3823, 0x00},

	{OV10823_TABLE_END, 0x00}
};

static ov10823_reg fsync_slave[] = {
	{0x3002, 0x80},
	{0x3009, 0x02},
	{0x3823, 0x30},
	{0x3824, 0x00}, /* CS reset value on fsin */
	{0x3825, 0x08},

	{OV10823_TABLE_END, 0x00}
};

#ifdef OV10823_UNUSED_MODES
static ov10823_reg mode_4336x2440_24MhzMCLK[] = {

	/* PLL */
	{0x3080, 0x04},
	{0x3083, 0x00},
	{0x3084, 0x03},
	{0x308b, 0x05},
	{0x308d, 0xae},
	{0x308e, 0x00},
	{0x308f, 0x09},

	{0x3011, 0xd0},
	{0x3012, 0x41},
	{0x3031, 0x0c},
	{0x3032, 0xc0},
	{0x3503, 0x07},
	{0x3603, 0x04},
	{0x3641, 0x83},
	{0x3643, 0x02},
	{0x3645, 0x41},
	{0x3646, 0x83},
	{0x3648, 0x0d},
	{0x3649, 0x86},
	{0x3653, 0x37},
	{0x3658, 0x8b},
	{0x3659, 0x87},
	{0x365c, 0x5a},
	{0x3660, 0x82},
	{0x3705, 0x22},
	{0x3719, 0x0c},
	{0x371b, 0x00},
	{0x371c, 0x80},
	{0x371e, 0x00},
	{0x371f, 0x20},
	{0x3720, 0xa0},
	{0x3721, 0xf0},
	{0x3723, 0x78},
	{0x372a, 0x08},
	{0x372c, 0x11},
	{0x373c, 0x02},
	{0x3749, 0xd7},
	{0x374a, 0x8c},
	{0x3752, 0x80},
	{0x382e, 0x04},
	{0x3901, 0x80},
	{0x3902, 0xc6},
	{0x4004, 0x00},
	{0x4005, 0x20},
	{0x400d, 0x10},
	{0x401b, 0x00},
	{0x401d, 0x00},
	{0x401f, 0x00},
	{0x4020, 0x01},
	{0x4022, 0x03},
	{0x4024, 0x0e},
	{0x4025, 0x10},
	{0x4026, 0x0f},
	{0x4027, 0x9f},
	{0x4028, 0x00},
	{0x4029, 0x04},
	{0x402d, 0x04},
	{0x402f, 0x08},
	{0x4602, 0x02},

#if OV10823_ADJUST_HS_PREPARE
	/* Bit[7] is hs_preparei_sel */
	{0x4800, 0x20},
	{0x4831, 0x6a},
#endif

	{0x4810, 0x00},
	{0x4811, 0x1f},
	{0x4819, 0xa0},
	{0x481b, 0x35},
	{0x481f, 0x30},
	{0x4823, 0x35},
	{0x4d00, 0x04},
	{0x4d01, 0x71},
	{0x4d03, 0xf5},
	{0x4d04, 0x0c},
	{0x4d05, 0xcc},
	{0x4d0b, 0x01},
	{0x5002, 0x08},
	{0x5a01, 0x08},
	{0x5a03, 0x06},
	{0x5a04, 0x10},
	{0x5a05, 0xf0},
	{0x5a06, 0x09},
	{0x5a07, 0x88},
	{0x5a08, 0x01},
	{0x5a04, 0x00},
	{0x5a06, 0x00},
	{0x5b01, 0x10},
	{0x5b05, 0xec},
	{0x5b09, 0x02},
	{0x5e10, 0x0c},

	{0x3082, 0x6c},
	{0x3092, 0x04},

	{0x300d, 0x22},
	{0x301b, 0xb4},
	{0x3033, 0x5c},
	{0x3034, 0x91},
	{0x3035, 0x6e},
	{0x3036, 0xa4},
	{0x3037, 0x6e},
	{0x3038, 0xa4},

	{0x3642, 0x35},
	{0x3663, 0x01},

	{0x3700, 0x44},
	{0x3701, 0x1c},
	{0x3702, 0x90},
	{0x3703, 0x60},
	{0x3704, 0x20},
	{0x3706, 0x18},
	{0x3707, 0x5d},
	{0x3708, 0x74},
	{0x3709, 0x40},
	{0x370a, 0x31},
	{0x370b, 0x33},
	{0x370c, 0x8a},
	{0x370d, 0x03},
	{0x370e, 0x28},
	{0x370f, 0x3b},
	{0x3710, 0x21},
	{0x3711, 0x15},
	{0x3712, 0x19},
	{0x3714, 0x42},
	{0x3730, 0x01},
	{0x3731, 0x6e},
	{0x3732, 0x01},
	{0x3733, 0x03},
	{0x3738, 0x02},
	{0x3739, 0x19},
	{0x373a, 0x01},
	{0x373b, 0xe6},
	{0x373d, 0xa3},
	{0x373e, 0x02},
	{0x373f, 0x70},
	{0x3740, 0x03},
	{0x3741, 0x33},
	{0x3742, 0x02},
	{0x3743, 0xf8},
	{0x3748, 0xa5},
	{0x374c, 0x88},

	{0x3802, 0x00},
	{0x3803, 0x08},
	{0x3806, 0x09},
	{0x3807, 0x98},
	{0x3808, 0x10},
	{0x3809, 0xf0},
	{0x380a, 0x09},
	{0x380b, 0x88},
	{0x380c, 0x15},
	{0x380d, 0x86},
	{0x380e, 0x09},
	{0x380f, 0xe0},
	{0x3810, 0x00},
	{0x3811, 0x08},
	{0x3813, 0x04},
	{0x3815, 0x11},
	{0x3820, 0x00},
	{0x3821, 0x00},
	{0x3834, 0x00},
	{0x4001, 0x00},
	{0x4003, 0x30},
	{0x402a, 0x0c},
	{0x402b, 0x08},
	{0x402e, 0x1c},
	{0x4837, 0x11},
	{0x5b04, 0x02},

	/* Exposure/Gain */
	{0x3500, 0x00},
	{0x3501, 0x9c},
	{0x3502, 0x00},
	{0x350b, 0x40},

	/* fsync */
	{0x3002, 0x80},
	{0x3009, 0x06},
	{0x3823, 0x00},
	{0x3826, 0x00},
	{0x3827, 0x00},
	{0x3830, 0x00},
	{0x3831, 0x00},

	{OV10823_TABLE_END, 0x00}
};

static ov10823_reg mode_4336x2440_24MhzMCLK_fsync_slave[] = {
	{0x3826, 0x09}, /* R reset value on fsin.  VTS - 4 */
	{0x3827, 0xdc},

	{OV10823_TABLE_END, 0x00}
};

static ov10823_reg mode_3000x2440_24MhzMCLK[] = {

	/* PLL */
	{0x3080, 0x04},
	{0x3083, 0x00},
	{0x3084, 0x03},
	{0x308b, 0x05},
	{0x308d, 0xae},
	{0x308e, 0x00},
	{0x308f, 0x09},

	{0x3011, 0xd0},
	{0x3012, 0x41},
	{0x3031, 0x0c},
	{0x3032, 0xc0},
	{0x3503, 0x07},
	{0x3603, 0x04},
	{0x3641, 0x83},
	{0x3643, 0x02},
	{0x3645, 0x41},
	{0x3646, 0x83},
	{0x3648, 0x0d},
	{0x3649, 0x86},
	{0x3653, 0x37},
	{0x3658, 0x8b},
	{0x3659, 0x87},
	{0x365c, 0x5a},
	{0x3660, 0x82},
	{0x3705, 0x22},
	{0x3719, 0x0c},
	{0x371b, 0x00},
	{0x371c, 0x80},
	{0x371e, 0x00},
	{0x371f, 0x20},
	{0x3720, 0xa0},
	{0x3721, 0xf0},
	{0x3723, 0x78},
	{0x372a, 0x08},
	{0x372c, 0x11},
	{0x373c, 0x02},
	{0x3749, 0xd7},
	{0x374a, 0x8c},
	{0x3752, 0x80},
	{0x382e, 0x04},
	{0x3901, 0x80},
	{0x3902, 0xc6},
	{0x4004, 0x00},
	{0x4005, 0x20},
	{0x400d, 0x10},
	{0x401b, 0x00},
	{0x401d, 0x00},
	{0x401f, 0x00},
	{0x4020, 0x01},
	{0x4022, 0x03},
	{0x4024, 0x0e},
	{0x4025, 0x10},
	{0x4026, 0x0f},
	{0x4027, 0x9f},
	{0x4028, 0x00},
	{0x4029, 0x04},
	{0x402d, 0x04},
	{0x402f, 0x08},
	{0x4602, 0x02},

#if OV10823_ADJUST_HS_PREPARE
	/* Bit[7] is hs_preparei_sel */
	{0x4802, 0x80},
	{0x4826, 0x10},
#endif

	{0x4810, 0x00},
	{0x4811, 0x1f},
	{0x4819, 0xa0},
	{0x481b, 0x35},
	{0x481f, 0x30},
	{0x4823, 0x35},
	{0x4d00, 0x04},
	{0x4d01, 0x71},
	{0x4d03, 0xf5},
	{0x4d04, 0x0c},
	{0x4d05, 0xcc},
	{0x4d0b, 0x01},
	{0x5002, 0x08},
	{0x5a00, 0x02},
	{0x5a01, 0xf6},
	{0x5a03, 0x06},
	{0x5a04, 0x0b},
	{0x5a05, 0xb8},
	{0x5a06, 0x09},
	{0x5a07, 0x88},
	{0x5a08, 0x01},
	{0x5b01, 0x10},
	{0x5b05, 0xec},
	{0x5b09, 0x02},
	{0x5e10, 0x0c},

	{0x3082, 0x6c},
	{0x3092, 0x04},

	{0x300d, 0x22},
	{0x301b, 0xb4},
	{0x3033, 0x5c},
	{0x3034, 0x91},
	{0x3035, 0x6e},
	{0x3036, 0xa4},
	{0x3037, 0x6e},
	{0x3038, 0xa4},

	{0x3642, 0x35},
	{0x3663, 0x01},

	{0x3700, 0x44},
	{0x3701, 0x1c},
	{0x3702, 0x90},
	{0x3703, 0x60},
	{0x3704, 0x20},
	{0x3706, 0x18},
	{0x3707, 0x5d},
	{0x3708, 0x74},
	{0x3709, 0x40},
	{0x370a, 0x31},
	{0x370b, 0x33},
	{0x370c, 0x8a},
	{0x370d, 0x03},
	{0x370e, 0x28},
	{0x370f, 0x3b},
	{0x3710, 0x21},
	{0x3711, 0x15},
	{0x3712, 0x19},
	{0x3714, 0x42},
	{0x3730, 0x01},
	{0x3731, 0x6e},
	{0x3732, 0x01},
	{0x3733, 0x03},
	{0x3738, 0x02},
	{0x3739, 0x19},
	{0x373a, 0x01},
	{0x373b, 0xe6},
	{0x373d, 0xa3},
	{0x373e, 0x02},
	{0x373f, 0x70},
	{0x3740, 0x03},
	{0x3741, 0x33},
	{0x3742, 0x02},
	{0x3743, 0xf8},
	{0x3748, 0xa5},
	{0x374c, 0x88},

	{0x3802, 0x00},
	{0x3803, 0x08},
	{0x3806, 0x09},
	{0x3807, 0x98},
	{0x3808, 0x0b},
	{0x3809, 0xb8},
	{0x380a, 0x09},
	{0x380b, 0x88},
	{0x380c, 0x15},
	{0x380d, 0x80},
	{0x380e, 0x09},
	{0x380f, 0xe0},
	{0x3810, 0x02},
	{0x3811, 0xf6},
	{0x3813, 0x04},
	{0x3815, 0x11},
	{0x3820, 0x00},
	{0x3821, 0x00},
	{0x3834, 0x00},
	{0x4001, 0x00},
	{0x4003, 0x30},
	{0x402a, 0x0c},
	{0x402b, 0x08},
	{0x402e, 0x1c},
	{0x4837, 0x12},
	{0x5b04, 0x02},

	/* Exposure/Gain */
	{0x3500, 0x00},
	{0x3501, 0x9c},
	{0x3502, 0x00},
	{0x350b, 0x40},

	/* fsync */
	{0x3002, 0x80},
	{0x3009, 0x06},
	{0x3823, 0x00},
	{0x3826, 0x00},
	{0x3827, 0x00},
	{0x3830, 0x00},
	{0x3831, 0x00},

	{OV10823_TABLE_END, 0x00}
};

static ov10823_reg mode_3000x2440_24MhzMCLK_fsync_slave[] = {
	{0x3826, 0x09}, /* R reset value on fsin.  VTS - 4 */
	{0x3827, 0xdc},

	{OV10823_TABLE_END, 0x00}
};

static ov10823_reg mode_2168x1220_24MhzMCLK[] = {

	/* PLL */
	{0x3080, 0x04},
	{0x3083, 0x00},
	{0x3084, 0x03},
	{0x308b, 0x05},
	{0x308d, 0xae},
	{0x308e, 0x00},
	{0x308f, 0x09},

	{0x3011, 0xd0},
	{0x3012, 0x41},
	{0x3031, 0x0c},
	{0x3032, 0xc0},
	{0x3503, 0x07},
	{0x3603, 0x04},
	{0x3641, 0x83},
	{0x3643, 0x02},
	{0x3645, 0x41},
	{0x3646, 0x83},
	{0x3648, 0x0d},
	{0x3649, 0x86},
	{0x3653, 0x37},
	{0x3658, 0x8b},
	{0x3659, 0x87},
	{0x365c, 0x5a},
	{0x3660, 0x82},
	{0x3705, 0x22},
	{0x3719, 0x0c},
	{0x371b, 0x00},
	{0x371c, 0x80},
	{0x371e, 0x00},
	{0x371f, 0x20},
	{0x3720, 0xa0},
	{0x3721, 0xf0},
	{0x3723, 0x78},
	{0x372a, 0x08},
	{0x372c, 0x11},
	{0x373c, 0x02},
	{0x3749, 0xd7},
	{0x374a, 0x8c},
	{0x3752, 0x80},
	{0x382e, 0x04},
	{0x3901, 0x80},
	{0x3902, 0xc6},
	{0x4004, 0x00},
	{0x4005, 0x20},
	{0x400d, 0x10},
	{0x401b, 0x00},
	{0x401d, 0x00},
	{0x401f, 0x00},
	{0x4020, 0x01},
	{0x4022, 0x03},
	{0x4024, 0x0e},
	{0x4025, 0x10},
	{0x4026, 0x0f},
	{0x4027, 0x9f},
	{0x4028, 0x00},
	{0x4029, 0x04},
	{0x402d, 0x04},
	{0x402f, 0x08},
	{0x4602, 0x02},

#if OV10823_ADJUST_HS_PREPARE
	/* Bit[7] is hs_preparei_sel */
	{0x4802, 0x80},
	{0x4826, 0x10},
#endif

	{0x4810, 0x00},
	{0x4811, 0x1f},
	{0x4819, 0xa0},
	{0x481b, 0x35},
	{0x481f, 0x30},
	{0x4823, 0x35},
	{0x4d00, 0x04},
	{0x4d01, 0x71},
	{0x4d03, 0xf5},
	{0x4d04, 0x0c},
	{0x4d05, 0xcc},
	{0x4d0b, 0x01},
	{0x5002, 0x08},
	{0x5a04, 0x00},
	{0x5a06, 0x00},
	{0x5b01, 0x10},
	{0x5b05, 0xec},
	{0x5b09, 0x02},
	{0x5e10, 0x0c},

	{0x3082, 0x6c},
	{0x3092, 0x04},

	{0x300d, 0x22},
	{0x301b, 0xb4},
	{0x3033, 0x5c},
	{0x3034, 0x91},
	{0x3035, 0x6e},
	{0x3036, 0xa4},
	{0x3037, 0x6e},
	{0x3038, 0xa4},

	{0x3642, 0x35},
	{0x3663, 0x11},

	{0x3700, 0x44},
	{0x3701, 0x1c},
	{0x3702, 0x90},
	{0x3703, 0x60},
	{0x3704, 0x20},
	{0x3706, 0x18},
	{0x3707, 0x5d},
	{0x3708, 0x74},
	{0x3709, 0x40},
	{0x370a, 0x33},
	{0x370b, 0x33},
	{0x370c, 0x8a},
	{0x370d, 0x03},
	{0x370e, 0x28},
	{0x370f, 0x3b},
	{0x3710, 0x21},
	{0x3711, 0x15},
	{0x3712, 0x19},
	{0x3714, 0x42},
	{0x3730, 0x01},
	{0x3731, 0x6e},
	{0x3732, 0x01},
	{0x3733, 0x03},
	{0x3738, 0x02},
	{0x3739, 0x19},
	{0x373a, 0x01},
	{0x373b, 0xe6},
	{0x373d, 0xa3},
	{0x373e, 0x02},
	{0x373f, 0x00},
	{0x3740, 0x03},
	{0x3741, 0x33},
	{0x3742, 0x02},
	{0x3743, 0xf8},
	{0x3748, 0xa5},
	{0x374c, 0x88},

	{0x3802, 0x00},
	{0x3803, 0x08},
	{0x3806, 0x09},
	{0x3807, 0x97},
	{0x3808, 0x08},
	{0x3809, 0x78},
	{0x380a, 0x04},
	{0x380b, 0xc4},
	{0x380c, 0x15},
	{0x380d, 0x80},
	{0x380e, 0x09},
	{0x380f, 0xe0},
	{0x3810, 0x00},
	{0x3811, 0x04},
	{0x3813, 0x02},
	{0x3815, 0x31},
	{0x3820, 0x02},
	{0x3821, 0x00},
	{0x3834, 0x01},
	{0x4001, 0x00},
	{0x4003, 0x1c},
	{0x402a, 0x0a},
	{0x402b, 0x06},
	{0x402e, 0x14},
	{0x4837, 0x12},
	{0x5b04, 0x02},

	/* Exposure/Gain */
	{0x3500, 0x00},
	{0x3501, 0x9c},
	{0x3502, 0x00},
	{0x350b, 0x40},

	/* fsync */
	{0x3002, 0x80},
	{0x3009, 0x06},
	{0x3823, 0x00},
	{0x3826, 0x00},
	{0x3827, 0x00},
	{0x3830, 0x00},
	{0x3831, 0x00},

	{OV10823_TABLE_END, 0x00}
};

static ov10823_reg mode_2168x1220_24MhzMCLK_fsync_slave[] = {
	{0x3826, 0x09}, /* R reset value on fsin.  VTS - 4 */
	{0x3827, 0xdc},

	{OV10823_TABLE_END, 0x00}
};

static ov10823_reg mode_4336x2440_26MhzMCLK[] = {

	/* PLL */
	{0x3080, 0x04},
	{0x3083, 0x00},
	{0x3084, 0x03},
	{0x308b, 0x06},
	{0x308d, 0xf1},
	{0x308e, 0x00},
	{0x308f, 0x09},

	{0x3011, 0xd0},
	{0x3012, 0x41},
	{0x3031, 0x0c},
	{0x3032, 0xc0},
	{0x3503, 0x07},
	{0x3603, 0x04},
	{0x3641, 0x83},
	{0x3643, 0x02},
	{0x3645, 0x41},
	{0x3646, 0x83},
	{0x3648, 0x0d},
	{0x3649, 0x86},
	{0x3653, 0x37},
	{0x3658, 0x8b},
	{0x3659, 0x87},
	{0x365c, 0x5a},
	{0x3660, 0x82},
	{0x3705, 0x22},
	{0x3719, 0x0c},
	{0x371b, 0x00},
	{0x371c, 0x80},
	{0x371e, 0x00},
	{0x371f, 0x20},
	{0x3720, 0xa0},
	{0x3721, 0xf0},
	{0x3723, 0x78},
	{0x372a, 0x08},
	{0x372c, 0x11},
	{0x373c, 0x02},
	{0x3749, 0xd7},
	{0x374a, 0x8c},
	{0x3752, 0x80},
	{0x382e, 0x04},
	{0x3901, 0x80},
	{0x3902, 0xc6},
	{0x4004, 0x00},
	{0x4005, 0x20},
	{0x400d, 0x10},
	{0x401b, 0x00},
	{0x401d, 0x00},
	{0x401f, 0x00},
	{0x4020, 0x01},
	{0x4022, 0x03},
	{0x4024, 0x0e},
	{0x4025, 0x10},
	{0x4026, 0x0f},
	{0x4027, 0x9f},
	{0x4028, 0x00},
	{0x4029, 0x04},
	{0x402d, 0x04},
	{0x402f, 0x08},
	{0x4602, 0x02},

#if OV10823_ADJUST_HS_PREPARE
	{0x4800, 0x20},
	{0x4831, 0x6a},
#endif

	{0x4810, 0x00},
	{0x4811, 0x1f},
	{0x4819, 0xa0},
	{0x481b, 0x35},
	{0x481f, 0x30},
	{0x4823, 0x35},
	{0x4d00, 0x04},
	{0x4d01, 0x71},
	{0x4d03, 0xf5},
	{0x4d04, 0x0c},
	{0x4d05, 0xcc},
	{0x4d0b, 0x01},
	{0x5002, 0x08},
	{0x5a01, 0x08},
	{0x5a03, 0x06},
	{0x5a04, 0x10},
	{0x5a05, 0xf0},
	{0x5a06, 0x09},
	{0x5a07, 0x88},
	{0x5a08, 0x01},
	{0x5b01, 0x10},
	{0x5b05, 0xec},
	{0x5b09, 0x02},
	{0x5e10, 0x0c},

	{0x3082, 0x69},
	{0x3092, 0x04},

	{0x300d, 0x22},
	{0x301b, 0xb4},
	{0x3033, 0x5c},
	{0x3034, 0x91},
	{0x3035, 0x6e},
	{0x3036, 0xa4},
	{0x3037, 0x6e},
	{0x3038, 0xa4},

	{0x3642, 0x35},
	{0x3663, 0x01},

	{0x3700, 0x44},
	{0x3701, 0x1c},
	{0x3702, 0x90},
	{0x3703, 0x60},
	{0x3704, 0x20},
	{0x3706, 0x18},
	{0x3707, 0x5d},
	{0x3708, 0x74},
	{0x3709, 0x40},
	{0x370a, 0x31},
	{0x370b, 0x33},
	{0x370c, 0x8a},
	{0x370d, 0x03},
	{0x370e, 0x28},
	{0x370f, 0x3b},
	{0x3710, 0x21},
	{0x3711, 0x15},
	{0x3712, 0x19},
	{0x3714, 0x42},
	{0x3730, 0x01},
	{0x3731, 0x6e},
	{0x3732, 0x01},
	{0x3733, 0x03},
	{0x3738, 0x02},
	{0x3739, 0x19},
	{0x373a, 0x01},
	{0x373b, 0xe6},
	{0x373d, 0xa3},
	{0x373e, 0x02},
	{0x373f, 0x70},
	{0x3740, 0x03},
	{0x3741, 0x33},
	{0x3742, 0x02},
	{0x3743, 0xf8},
	{0x3748, 0xa5},
	{0x374c, 0x88},

	{0x3802, 0x00},
	{0x3803, 0x08},
	{0x3806, 0x09},
	{0x3807, 0x98},
	{0x3808, 0x10},
	{0x3809, 0xf0},
	{0x380a, 0x09},
	{0x380b, 0x88},
	{0x380c, 0x15},
	{0x380d, 0x86},
	{0x380e, 0x09},
	{0x380f, 0xe0},
	{0x3810, 0x00},
	{0x3811, 0x08},
	{0x3813, 0x04},
	{0x3815, 0x11},
	{0x3820, 0x00},
	{0x3821, 0x00},
	{0x3834, 0x00},
	{0x4001, 0x00},
	{0x4003, 0x30},
	{0x402a, 0x0c},
	{0x402b, 0x08},
	{0x402e, 0x1c},
	{0x4837, 0x11},
	{0x5b04, 0x02},

	/* Exposure/Gain */
	{0x3500, 0x00},
	{0x3501, 0x9c},
	{0x3502, 0x00},
	{0x350b, 0x40},

	/* fsync */
	{0x3002, 0x80},
	{0x3009, 0x06},
	{0x3823, 0x00},
	{0x3826, 0x00},
	{0x3827, 0x00},
	{0x3830, 0x00},
	{0x3831, 0x00},

	{OV10823_TABLE_END, 0x00}
};

static ov10823_reg mode_4336x2440_26MhzMCLK_fsync_slave[] = {
	{0x3826, 0x09}, /* R reset value on fsin.  VTS - 4 */
	{0x3827, 0xdc},

	{OV10823_TABLE_END, 0x00}
};

static ov10823_reg mode_3000x2440_26MhzMCLK[] = {

	/* PLL */
	{0x3080, 0x04},
	{0x3083, 0x00},
	{0x3084, 0x03},
	{0x308b, 0x06},
	{0x308d, 0xf1},
	{0x308e, 0x00},
	{0x308f, 0x09},

	{0x3011, 0xd0},
	{0x3012, 0x41},
	{0x3031, 0x0c},
	{0x3032, 0xc0},
	{0x3503, 0x07},
	{0x3603, 0x04},
	{0x3641, 0x83},
	{0x3643, 0x02},
	{0x3645, 0x41},
	{0x3646, 0x83},
	{0x3648, 0x0d},
	{0x3649, 0x86},
	{0x3653, 0x37},
	{0x3658, 0x8b},
	{0x3659, 0x87},
	{0x365c, 0x5a},
	{0x3660, 0x82},
	{0x3705, 0x22},
	{0x3719, 0x0c},
	{0x371b, 0x00},
	{0x371c, 0x80},
	{0x371e, 0x00},
	{0x371f, 0x20},
	{0x3720, 0xa0},
	{0x3721, 0xf0},
	{0x3723, 0x78},
	{0x372a, 0x08},
	{0x372c, 0x11},
	{0x373c, 0x02},
	{0x3749, 0xd7},
	{0x374a, 0x8c},
	{0x3752, 0x80},
	{0x382e, 0x04},
	{0x3901, 0x80},
	{0x3902, 0xc6},
	{0x4004, 0x00},
	{0x4005, 0x20},
	{0x400d, 0x10},
	{0x401b, 0x00},
	{0x401d, 0x00},
	{0x401f, 0x00},
	{0x4020, 0x01},
	{0x4022, 0x03},
	{0x4024, 0x0e},
	{0x4025, 0x10},
	{0x4026, 0x0f},
	{0x4027, 0x9f},
	{0x4028, 0x00},
	{0x4029, 0x04},
	{0x402d, 0x04},
	{0x402f, 0x08},
	{0x4602, 0x02},

#if OV10823_ADJUST_HS_PREPARE
	{0x4800, 0x20},
	{0x4831, 0x6a},
#endif

	{0x4810, 0x00},
	{0x4811, 0x1f},
	{0x4819, 0xa0},
	{0x481b, 0x35},
	{0x481f, 0x30},
	{0x4823, 0x35},
	{0x4d00, 0x04},
	{0x4d01, 0x71},
	{0x4d03, 0xf5},
	{0x4d04, 0x0c},
	{0x4d05, 0xcc},
	{0x4d0b, 0x01},
	{0x5002, 0x08},
	{0x5a00, 0x02},
	{0x5a01, 0xf6},
	{0x5a03, 0x06},
	{0x5a04, 0x0b},
	{0x5a05, 0xb8},
	{0x5a06, 0x09},
	{0x5a07, 0x88},
	{0x5a08, 0x01},
	{0x5b01, 0x10},
	{0x5b05, 0xec},
	{0x5b09, 0x02},
	{0x5e10, 0x0c},

	{0x3082, 0x64},
	{0x3092, 0x04},

	{0x300d, 0x22},
	{0x301b, 0xb4},
	{0x3033, 0x5c},
	{0x3034, 0x91},
	{0x3035, 0x6e},
	{0x3036, 0xa4},
	{0x3037, 0x6e},
	{0x3038, 0xa4},

	{0x3642, 0x35},
	{0x3663, 0x01},

	{0x3700, 0x44},
	{0x3701, 0x1c},
	{0x3702, 0x90},
	{0x3703, 0x60},
	{0x3704, 0x20},
	{0x3706, 0x18},
	{0x3707, 0x5d},
	{0x3708, 0x74},
	{0x3709, 0x40},
	{0x370a, 0x31},
	{0x370b, 0x33},
	{0x370c, 0x8a},
	{0x370d, 0x03},
	{0x370e, 0x28},
	{0x370f, 0x3b},
	{0x3710, 0x21},
	{0x3711, 0x15},
	{0x3712, 0x19},
	{0x3714, 0x42},
	{0x3730, 0x01},
	{0x3731, 0x6e},
	{0x3732, 0x01},
	{0x3733, 0x03},
	{0x3738, 0x02},
	{0x3739, 0x19},
	{0x373a, 0x01},
	{0x373b, 0xe6},
	{0x373d, 0xa3},
	{0x373e, 0x02},
	{0x373f, 0x70},
	{0x3740, 0x03},
	{0x3741, 0x33},
	{0x3742, 0x02},
	{0x3743, 0xf8},
	{0x3748, 0xa5},
	{0x374c, 0x88},

	{0x3802, 0x00},
	{0x3803, 0x08},
	{0x3806, 0x09},
	{0x3807, 0x98},
	{0x3808, 0x0b},
	{0x3809, 0xb8},
	{0x380a, 0x09},
	{0x380b, 0x88},
	{0x380c, 0x15},
	{0x380d, 0x80},
	{0x380e, 0x09},
	{0x380f, 0xe0},
	{0x3810, 0x02},
	{0x3811, 0xf6},
	{0x3813, 0x04},
	{0x3815, 0x11},
	{0x3820, 0x00},
	{0x3821, 0x00},
	{0x3834, 0x00},
	{0x4001, 0x00},
	{0x4003, 0x30},
	{0x402a, 0x0c},
	{0x402b, 0x08},
	{0x402e, 0x1c},
	{0x4837, 0x12},
	{0x5b04, 0x02},

	/* Exposure/Gain */
	{0x3500, 0x00},
	{0x3501, 0x9c},
	{0x3502, 0x00},
	{0x350b, 0x40},

	/* fsync */
	{0x3002, 0x80},
	{0x3009, 0x06},
	{0x3823, 0x00},
	{0x3826, 0x00},
	{0x3827, 0x00},
	{0x3830, 0x00},
	{0x3831, 0x00},

	{OV10823_TABLE_END, 0x00}
};

static ov10823_reg mode_3000x2440_26MhzMCLK_fsync_slave[] = {
	{0x3826, 0x09}, /* R reset value on fsin.  VTS - 4 */
	{0x3827, 0xdc},

	{OV10823_TABLE_END, 0x00}
};

static ov10823_reg mode_2168x1220_26MhzMCLK[] = {

	/* PLL */
	{0x3080, 0x04},
	{0x3083, 0x00},
	{0x3084, 0x03},
	{0x308b, 0x06},
	{0x308d, 0xf1},
	{0x308e, 0x00},
	{0x308f, 0x09},

	{0x3011, 0xd0},
	{0x3012, 0x41},
	{0x3031, 0x0c},
	{0x3032, 0xc0},
	{0x3503, 0x07},
	{0x3603, 0x04},
	{0x3641, 0x83},
	{0x3643, 0x02},
	{0x3645, 0x41},
	{0x3646, 0x83},
	{0x3648, 0x0d},
	{0x3649, 0x86},
	{0x3653, 0x37},
	{0x3658, 0x8b},
	{0x3659, 0x87},
	{0x365c, 0x5a},
	{0x3660, 0x82},
	{0x3705, 0x22},
	{0x3719, 0x0c},
	{0x371b, 0x00},
	{0x371c, 0x80},
	{0x371e, 0x00},
	{0x371f, 0x20},
	{0x3720, 0xa0},
	{0x3721, 0xf0},
	{0x3723, 0x78},
	{0x372a, 0x08},
	{0x372c, 0x11},
	{0x373c, 0x02},
	{0x3749, 0xd7},
	{0x374a, 0x8c},
	{0x3752, 0x80},
	{0x382e, 0x04},
	{0x3901, 0x80},
	{0x3902, 0xc6},
	{0x4004, 0x00},
	{0x4005, 0x20},
	{0x400d, 0x10},
	{0x401b, 0x00},
	{0x401d, 0x00},
	{0x401f, 0x00},
	{0x4020, 0x01},
	{0x4022, 0x03},
	{0x4024, 0x0e},
	{0x4025, 0x10},
	{0x4026, 0x0f},
	{0x4027, 0x9f},
	{0x4028, 0x00},
	{0x4029, 0x04},
	{0x402d, 0x04},
	{0x402f, 0x08},
	{0x4602, 0x02},

#if OV10823_ADJUST_HS_PREPARE
	/* Bit[7] is hs_preparei_sel */
	{0x4802, 0x80},
	{0x4826, 0x10},
#endif

	{0x4810, 0x00},
	{0x4811, 0x1f},
	{0x4819, 0xa0},
	{0x481b, 0x35},
	{0x481f, 0x30},
	{0x4823, 0x35},
	{0x4d00, 0x04},
	{0x4d01, 0x71},
	{0x4d03, 0xf5},
	{0x4d04, 0x0c},
	{0x4d05, 0xcc},
	{0x4d0b, 0x01},
	{0x5002, 0x08},
	{0x5a04, 0x00},
	{0x5a06, 0x00},
	{0x5b01, 0x10},
	{0x5b05, 0xec},
	{0x5b09, 0x02},
	{0x5e10, 0x0c},

	{0x3082, 0x64},
	{0x3092, 0x04},

	{0x300d, 0x22},
	{0x301b, 0xb4},
	{0x3033, 0x5c},
	{0x3034, 0x91},
	{0x3035, 0x6e},
	{0x3036, 0xa4},
	{0x3037, 0x6e},
	{0x3038, 0xa4},

	{0x3642, 0x35},
	{0x3663, 0x11},

	{0x3700, 0x44},
	{0x3701, 0x1c},
	{0x3702, 0x90},
	{0x3703, 0x60},
	{0x3704, 0x20},
	{0x3706, 0x18},
	{0x3707, 0x5d},
	{0x3708, 0x74},
	{0x3709, 0x40},
	{0x370a, 0x33},
	{0x370b, 0x33},
	{0x370c, 0x8a},
	{0x370d, 0x03},
	{0x370e, 0x28},
	{0x370f, 0x3b},
	{0x3710, 0x21},
	{0x3711, 0x15},
	{0x3712, 0x19},
	{0x3714, 0x42},
	{0x3730, 0x01},
	{0x3731, 0x6e},
	{0x3732, 0x01},
	{0x3733, 0x03},
	{0x3738, 0x02},
	{0x3739, 0x19},
	{0x373a, 0x01},
	{0x373b, 0xe6},
	{0x373d, 0xa3},
	{0x373e, 0x02},
	{0x373f, 0x00},
	{0x3740, 0x03},
	{0x3741, 0x33},
	{0x3742, 0x02},
	{0x3743, 0xf8},
	{0x3748, 0xa5},
	{0x374c, 0x88},

	{0x3802, 0x00},
	{0x3803, 0x08},
	{0x3806, 0x09},
	{0x3807, 0x97},
	{0x3808, 0x08},
	{0x3809, 0x78},
	{0x380a, 0x04},
	{0x380b, 0xc4},
	{0x380c, 0x15},
	{0x380d, 0x80},
	{0x380e, 0x09},
	{0x380f, 0xe0},
	{0x3810, 0x00},
	{0x3811, 0x04},
	{0x3813, 0x02},
	{0x3815, 0x31},
	{0x3820, 0x02},
	{0x3821, 0x00},
	{0x3834, 0x01},
	{0x4001, 0x00},
	{0x4003, 0x1c},
	{0x402a, 0x0a},
	{0x402b, 0x06},
	{0x402e, 0x14},
	{0x4837, 0x12},
	{0x5b04, 0x02},

	/* Exposure/Gain */
	{0x3500, 0x00},
	{0x3501, 0x9c},
	{0x3502, 0x00},
	{0x350b, 0x40},

	/* fsync */
	{0x3002, 0x80},
	{0x3009, 0x06},
	{0x3823, 0x00},
	{0x3826, 0x00},
	{0x3827, 0x00},
	{0x3830, 0x00},
	{0x3831, 0x00},

	{OV10823_TABLE_END, 0x00}
};

static ov10823_reg mode_2168x1220_26MhzMCLK_fsync_slave[] = {
	{0x3826, 0x09}, /* R reset value on fsin.  VTS - 4 */
	{0x3827, 0xdc},

	{OV10823_TABLE_END, 0x00}
};

static ov10823_reg mode_4336x1220_60fps_26MhzMCLK[] = {

	/* PLL */
	{0x3080, 0x04},
	{0x3083, 0x00},
	{0x3084, 0x03},
	{0x308b, 0x06},
	{0x308d, 0xf1},
	{0x308e, 0x00},
	{0x308f, 0x09},

	{0x3011, 0xd0},
	{0x3012, 0x41},
	{0x3031, 0x0c},
	{0x3032, 0xc0},
	{0x3503, 0x07},
	{0x3603, 0x04},
	{0x3641, 0x83},
	{0x3643, 0x02},
	{0x3645, 0x41},
	{0x3646, 0x83},
	{0x3648, 0x0d},
	{0x3649, 0x86},
	{0x3653, 0x37},
	{0x3658, 0x8b},
	{0x3659, 0x87},
	{0x365c, 0x5a},
	{0x3660, 0x82},
	{0x3705, 0x22},
	{0x3719, 0x0c},
	{0x371b, 0x00},
	{0x371c, 0x80},
	{0x371e, 0x00},
	{0x371f, 0x20},
	{0x3720, 0xf0},
	{0x3721, 0xf0},
	{0x3723, 0x78},
	{0x372a, 0x08},
	{0x372c, 0x11},
	{0x373c, 0x02},
	{0x3749, 0xd7},
	{0x374a, 0x8c},
	{0x3752, 0x80},
	{0x382e, 0x04},
	{0x3901, 0x00},
	{0x3902, 0xc6},
	{0x4004, 0x00},
	{0x4005, 0x20},
	{0x400d, 0x10},
	{0x401b, 0x00},
	{0x401d, 0x00},
	{0x401f, 0x00},
	{0x4020, 0x01},
	{0x4022, 0x03},
	{0x4024, 0x0e},
	{0x4025, 0x10},
	{0x4026, 0x0f},
	{0x4027, 0x9f},
	{0x4028, 0x00},
	{0x4029, 0x04},
	{0x402d, 0x04},
	{0x402f, 0x08},
	{0x4602, 0x02},

#if OV10823_ADJUST_HS_PREPARE
	{0x4802, 0x80},
	{0x4826, 0x10},
#endif

	{0x4810, 0x00},
	{0x4811, 0x1f},
	{0x4819, 0xa0},
	{0x481b, 0x35},
	{0x481f, 0x30},
	{0x4823, 0x35},
	{0x4d00, 0x04},
	{0x4d01, 0x71},
	{0x4d03, 0xf5},
	{0x4d04, 0x0c},
	{0x4d05, 0xcc},
	{0x4d0b, 0x01},
	{0x5001, 0x03},
	{0x5002, 0x08},
	{0x5a04, 0x00},
	{0x5a06, 0x00},
	{0x5b01, 0x10},
	{0x5b05, 0xec},
	{0x5b09, 0x02},
	{0x5e10, 0x0c},

	{0x3082, 0x64},
	{0x3092, 0x04},

	{0x300d, 0x22},
	{0x301b, 0xb4},
	{0x3033, 0x5c},
	{0x3034, 0x91},
	{0x3035, 0x6e},
	{0x3036, 0xa4},
	{0x3037, 0x6e},
	{0x3038, 0xa4},

	{0x3642, 0x35},
	{0x3663, 0x01},

	{0x3700, 0x44},
	{0x3701, 0x1c},
	{0x3702, 0x90},
	{0x3703, 0x60},
	{0x3704, 0x20},
	{0x3706, 0x18},
	{0x3707, 0x5d},
	{0x3708, 0x74},
	{0x3709, 0x40},
	{0x370a, 0x33},
	{0x370b, 0x33},
	{0x370c, 0x8a},
	{0x370d, 0x03},
	{0x370e, 0x28},
	{0x370f, 0x3b},
	{0x3710, 0x21},
	{0x3711, 0x15},
	{0x3712, 0x19},
	{0x3714, 0x42},
	{0x3730, 0x01},
	{0x3731, 0x6e},
	{0x3732, 0x01},
	{0x3733, 0x03},
	{0x3738, 0x02},
	{0x3739, 0x19},
	{0x373a, 0x01},
	{0x373b, 0xe6},
	{0x373d, 0xa3},
	{0x373e, 0x02},
	{0x373f, 0x70},
	{0x3740, 0x03},
	{0x3741, 0x33},
	{0x3742, 0x02},
	{0x3743, 0xf8},
	{0x3748, 0xa5},
	{0x374c, 0x88},

	{0x3802, 0x00},
	{0x3803, 0x08},
	{0x3806, 0x09},
	{0x3807, 0x97},
	{0x3808, 0x10},
	{0x3809, 0xf0},
	{0x380a, 0x04},
	{0x380b, 0xc4},
	{0x380c, 0x15},
	{0x380d, 0x80},
	{0x380e, 0x04},
	{0x380f, 0xf0},
	{0x3810, 0x00},
	{0x3811, 0x08},
	{0x3813, 0x02},
	{0x3815, 0x31},
	{0x3820, 0x02},
	{0x3821, 0x00},
	{0x3834, 0x00},
	{0x4001, 0x00},
	{0x4003, 0x1c},
	{0x402a, 0x0a},
	{0x402b, 0x06},
	{0x402e, 0x14},
	{0x4837, 0x12},
	{0x5b04, 0x02},

	/* Exposure/Gain */
	{0x3500, 0x00},
	{0x3501, 0x4d},
	{0x3502, 0x00},
	{0x350b, 0x40},

	/* fsync */
	{0x3002, 0x80},
	{0x3009, 0x06},
	{0x3823, 0x00},
	{0x3826, 0x00},
	{0x3827, 0x00},
	{0x3830, 0x00},
	{0x3831, 0x00},

	{OV10823_TABLE_END, 0x00}
};

static ov10823_reg mode_4336x1220_60fps_26MhzMCLK_fsync_slave[] = {
	{0x3826, 0x04}, /* R reset value on fsin.  VTS - 4 */
	{0x3827, 0xec},

	{OV10823_TABLE_END, 0x00}
};
#endif /* OV10823_UNUSED_MODES */

static ov10823_reg mode_2168x1220_60fps_26MhzMCLK[] = {

	/* PLL */
	{0x3080, 0x04},
	{0x3083, 0x00},
	{0x3084, 0x03},
	{0x308b, 0x06},
	{0x308d, 0xf1},
	{0x308e, 0x00},
	{0x308f, 0x09},

	{0x3011, 0xd0},
	{0x3012, 0x41},
	{0x3031, 0x0c},
	{0x3032, 0xc0},
	{0x3503, 0x07},
	{0x3603, 0x04},
	{0x3641, 0x83},
	{0x3643, 0x02},
	{0x3645, 0x41},
	{0x3646, 0x83},
	{0x3648, 0x0d},
	{0x3649, 0x86},
	{0x3653, 0x37},
	{0x3658, 0x8b},
	{0x3659, 0x87},
	{0x365c, 0x5a},
	{0x3660, 0x82},
	{0x3705, 0x22},
	{0x3719, 0x0c},
	{0x371b, 0x00},
	{0x371c, 0x80},
	{0x371e, 0x00},
	{0x371f, 0x20},
	{0x3720, 0xf0},
	{0x3721, 0xf0},
	{0x3723, 0x78},
	{0x372a, 0x08},
	{0x372c, 0x11},
	{0x373c, 0x02},
	{0x3749, 0xd7},
	{0x374a, 0x8c},
	{0x3752, 0x80},
	{0x382e, 0x04},
	{0x3901, 0x00},
	{0x3902, 0xc6},
	{0x4004, 0x00},
	{0x4005, 0x20},
	{0x400d, 0x10},
	{0x401b, 0x00},
	{0x401d, 0x00},
	{0x401f, 0x00},
	{0x4020, 0x01},
	{0x4022, 0x03},
	{0x4024, 0x0e},
	{0x4025, 0x10},
	{0x4026, 0x0f},
	{0x4027, 0x9f},
	{0x4028, 0x00},
	{0x4029, 0x04},
	{0x402d, 0x04},
	{0x402f, 0x08},
	{0x4602, 0x02},

#if OV10823_ADJUST_HS_PREPARE
	/* Bit[7] is hs_preparei_sel */
	{0x4802, 0x80},
	{0x4826, 0x10},
#endif

	{0x4810, 0x00},
	{0x4811, 0x1f},
	{0x4819, 0xa0},
	{0x481b, 0x35},
	{0x481f, 0x30},
	{0x4823, 0x35},
	{0x4d00, 0x04},
	{0x4d01, 0x71},
	{0x4d03, 0xf5},
	{0x4d04, 0x0c},
	{0x4d05, 0xcc},
	{0x4d0b, 0x01},
	{0x5001, 0x03},
	{0x5002, 0x08},
	{0x5a04, 0x00},
	{0x5a06, 0x00},
	{0x5b01, 0x10},
	{0x5b05, 0xec},
	{0x5b09, 0x02},
	{0x5e10, 0x0c},

	{0x3082, 0x64},
	{0x3092, 0x04},

	{0x300d, 0x22},
	{0x301b, 0xb4},
	{0x3033, 0x5c},
	{0x3034, 0x91},
	{0x3035, 0x6e},
	{0x3036, 0xa4},
	{0x3037, 0x6e},
	{0x3038, 0xa4},

	{0x3642, 0x35},
	{0x3663, 0x11},

	{0x3700, 0x44},
	{0x3701, 0x1c},
	{0x3702, 0x90},
	{0x3703, 0x60},
	{0x3704, 0x20},
	{0x3706, 0x18},
	{0x3707, 0x5d},
	{0x3708, 0x74},
	{0x3709, 0x40},
	{0x370a, 0x33},
	{0x370b, 0x33},
	{0x370c, 0x8a},
	{0x370d, 0x03},
	{0x370e, 0x28},
	{0x370f, 0x3b},
	{0x3710, 0x21},
	{0x3711, 0x15},
	{0x3712, 0x19},
	{0x3714, 0x42},
	{0x3730, 0x01},
	{0x3731, 0x6e},
	{0x3732, 0x01},
	{0x3733, 0x03},
	{0x3738, 0x02},
	{0x3739, 0x19},
	{0x373a, 0x01},
	{0x373b, 0xe6},
	{0x373d, 0xa3},
	{0x373e, 0x02},
	{0x373f, 0x70},
	{0x3740, 0x03},
	{0x3741, 0x33},
	{0x3742, 0x02},
	{0x3743, 0xf8},
	{0x3748, 0xa5},
	{0x374c, 0x88},

	{0x3802, 0x00},
	{0x3803, 0x08},
	{0x3806, 0x09},
	{0x3807, 0x97},
	{0x3808, 0x08},
	{0x3809, 0x78},
	{0x380a, 0x04},
	{0x380b, 0xc4},
	{0x380c, 0x15},
	{0x380d, 0x80},
	{0x380e, 0x04},
	{0x380f, 0xf0},
	{0x3810, 0x00},
	{0x3811, 0x04},
	{0x3813, 0x02},
	{0x3815, 0x31},
	{0x3820, 0x02},
	{0x3821, 0x00},
	{0x3834, 0x01},
	{0x4001, 0x00},
	{0x4003, 0x1c},
	{0x402a, 0x0a},
	{0x402b, 0x06},
	{0x402e, 0x14},
	{0x4837, 0x12},
	{0x5b04, 0x02},

	/* Exposure/Gain */
	{0x3500, 0x00},
	{0x3501, 0x4d},
	{0x3502, 0x00},
	{0x350b, 0x40},

	/* fsync */
	{0x3002, 0x80},
	{0x3009, 0x06},
	{0x3823, 0x00},
	{0x3826, 0x00},
	{0x3827, 0x00},
	{0x3830, 0x00},
	{0x3831, 0x00},

	{OV10823_TABLE_END, 0x00}
};

static ov10823_reg mode_2168x1220_60fps_26MhzMCLK_fsync_slave[] = {
	{0x3826, 0x04}, /* R reset value on fsin.  VTS - 4 */
	{0x3827, 0xec},

	{OV10823_TABLE_END, 0x00}
};

enum {
#ifdef OV10823_UNUSED_MODES
	OV10823_MODE_4336X2440,
	OV10823_MODE_3000X2440,
	OV10823_MODE_2168X1220,
#endif
	OV10823_MODE_2168X1220_60FPS,
	OV10823_MODE_START_STREAM,
	OV10823_MODE_STOP_STREAM,
};

static ov10823_reg *mode_table[] = {
#ifdef OV10823_UNUSED_MODES
	[OV10823_MODE_4336X2440] = mode_4336x2440_26MhzMCLK,
	[OV10823_MODE_3000X2440] = mode_3000x2440_26MhzMCLK,
	[OV10823_MODE_2168X1220] = mode_2168x1220_26MhzMCLK,
#endif
	[OV10823_MODE_2168X1220_60FPS] = mode_2168x1220_60fps_26MhzMCLK,

	[OV10823_MODE_START_STREAM] = ov10823_start,
	[OV10823_MODE_STOP_STREAM] = ov10823_stop,
};

static ov10823_reg *fsync_slave_mode_table[] = {
#ifdef OV10823_UNUSED_MODES
	[OV10823_MODE_4336X2440] = mode_4336x2440_26MhzMCLK_fsync_slave,
	[OV10823_MODE_3000X2440] = mode_3000x2440_26MhzMCLK_fsync_slave,
	[OV10823_MODE_2168X1220] = mode_2168x1220_26MhzMCLK_fsync_slave,
#endif
	[OV10823_MODE_2168X1220_60FPS] =
		mode_2168x1220_60fps_26MhzMCLK_fsync_slave,
};

enum {
	OV10823_FSYNC_NONE,
	OV10823_FSYNC_MASTER,
	OV10823_FSYNC_SLAVE,
};

static ov10823_reg *fsync_table[] = {
	[OV10823_FSYNC_NONE] = NULL,
	[OV10823_FSYNC_MASTER] = fsync_master,
	[OV10823_FSYNC_SLAVE] = fsync_slave,
};

static const int ov10823_30fps[] = {
	30,
};

static const int ov10823_60fps[] = {
	60,
};

static const struct camera_common_frmfmt ov10823_frmfmt[] = {
#ifdef OV10823_UNUSED_MODES
	{{4336, 2440}, ov10823_30fps, 1, 0, OV10823_MODE_4336X2440},
	{{3000, 2440}, ov10823_30fps, 1, 0, OV10823_MODE_3000X2440},
	{{2168, 1220}, ov10823_30fps, 1, 0, OV10823_MODE_2168X1220},
#endif
	{{2168, 1220}, ov10823_60fps, 1, 0, OV10823_MODE_2168X1220_60FPS},
};
#endif  /* __OV10823_I2C_TABLES__ */
